<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<%@include file="/view/common/common.jsp"%>


	<script type="text/javascript">
		function searchData() {
			$('#tab').datagrid('load',serializeForm($('#mySearchForm')));
		}

		function edit() {
			$("#system_user_addDialog").form('clear')
            var rows = $('#tab').datagrid('getSelections');
			if (rows.length != 1) {
				$.messager.alert('消息', '请选择一条数据!', 'info');
				return false;
			}
			
			$("#system_user_addDialog").dialog({
				modal : true,
				iconCls : 'icon-edit',
				title : '充值',
				width : 300,
				cache : false,
				shadow:false,
				closed : false
			});


			$('#my_form').form('load',{
				id:rows[0].id,
			});

		}
		
		function saveOrUpDate() {
			var	url ='${ctx}/bIfibCup/rechargeIFBI.do';
			$("#my_form").form('submit', {
				url : url,
				onSubmit : function() {
					if ($(this).form('validate') == false) {
						return false;
					}
					return true;
				},
				success : function(result) {
					var result = eval('(' + result + ')');
					if (result.isSuc) {
						$.messager.alert('消息', result.msg, 'info');
						$("#system_user_addDialog").dialog("close");
						$('#tab').datagrid('reload');
					} else {
						$.messager.alert('错误', result.msg, 'error');
					}
				}
			});
		}
		
		
	</script>

</head>
<body>

<div class="easyui-panel" fit="true">
	<div id="system_user_list_tb" style="height: auto; padding-left: auto;">
		<c:if test="${SESSION_INFO_OBJECT.type==0}">
			<a href="#" class="easyui-linkbutton" onclick="edit()" data-options="iconCls:'icon-edit',plain:true">充值</a>
		</c:if>
	</div>
	<table id="tab" class="easyui-datagrid" fit="true" style="height:auto;width:auto;" url="${ctx}/bIfibCup/getIfibList.do"
		   rownumbers="true" pagination="true" pagePosition="top" singleSelect="true"  toolbar="#system_user_list_tb">
		<thead>
		<tr>
			<th field="id"  width="80" align="center" style="display: none;">ID</th>
			<th field="ifibNum"  width="80" align="center">Ifib数量</th>
			<th field="createTime" width="135" align="center">创建时间</th>
			<th field="updateTime"  width="135" align="center">最后更新时间</th>
		</tr>
		</thead>
	</table>


	<!-- 添加 ------------start -->
	<div id="system_user_addDialog"  class="easyui-dialog"  data-options="closed:true"  buttons="#addButs1">
		<form id="my_form" method="post">

			<input type="hidden" id="id" name="id"  value="" >

			<table style="margin: 10px 20px;">
				<tr>
					<td style="text-align: right;">数量:</td>
					<td><input type="text" id="amount" name="amount"       style="width: 150px; height: 25px;" class="easyui-numberbox"  data-options="required:true,precision:4,missingMessage:'为必填项'" ></td>
				</tr>
				<tr>
					<td style="text-align: right;">交易密码:</td>
					<td><input type="text" id="trade_pwd" name="tradePwd"       style="width: 150px; height: 25px;" class="easyui-textbox"  data-options="required:true,missingMessage:'为必填项'" ></td>
				</tr>
			</table>
		</form>
		<div id="addButs1"  >
			<a href="#" class="easyui-linkbutton"   onclick="saveOrUpDate()"   style="width:80px;height:30px;" iconCls="icon-ok" >提交</a>
		</div>
	</div>
	<!-- 添加 ------------end -->

</div>
</body>
</html>
